<?php

class Etudiant {
private $nom;
private $prenom;
private $fra, $ang, $mat, $edm, $e4, $e5, $e6; //les notes

public function __construct($nom, $prenom, $fra, $ang, $mat, $edm, $e4, $e5, $e6) {
$this->nom = $nom;
$this->prenom = $prenom;
$this->fra = $fra;
$this->ang = $ang;
$this->mat = $mat;
$this->edm = $edm;
$this->e4 = $e4;
$this->e5 = $e5;
$this->e6 = $e6;
}

public function moyenne() {
//coefficients des epreuves SIO
$coefFra = 2;
$coefAng = 2;
$coefMat = 2;
$coefEdm = 4;
$coefE4 = 4;
$coefE5 = 5;
$coefE6 = 3;
$coefTotal=22; //hors epreuves optionnelles et maths sio1
//ici, completer le calcul de la moyenne ponderee de l'etudiant
return ($coefFra * $fra + $coefAng * $ang + $coefMat * $mat + $coefEdm * $edm + $coefE4 * $e4
        + $coefE5 * $e5 + $coefE6 * $e6)/$coefTotal;
}

public function mention($moyenne) {
switch ($moyenne) {
case ($moyenne < 11): $mention = "Preuves"; //doit faire ses preuves a l’examen
break;
case ($moyenne < 16): $mention = "Favorable";
break;
case ($moyenne <= 20): $mention = "Tres favorable";
break;
default: $mention = "impossible";
break;
}
return $mention;
}

public function __toString() {
$msg = $this->nom . " " . $this->prenom;
return $msg;
}

}

?>